import request from '@/utils/request';

/*获取月卡列表接口*/
export const fetchCardListApi = (params) => {
  return request({
    method: 'GET',
    url: '/parking/card/list',
    params,
  });
};

/*添加月卡接口*/
export const addCardApi = (data) => {
  return request({
    url: '/parking/card',
    method: 'POST',
    data,
  });
};

/*获取月卡详情*/
export const findCardApi = (id) => {
  return request({
    url: `/parking/card/detail/${id}`,
    method: 'GET',
  });
};

/*编辑月卡接口*/
export const editCardApi = (data) => {
  return request({
    url: `/parking/card/edit`,
    method: 'PUT',
    data,
  });
};

/*续费月卡接口*/
export const renewCardApi = (data) => {
  return request({
    url: '/parking/card/recharge',
    method: 'POST',
    data,
  });
};

/*查看月卡接口*/
export const viewCardApi = (id) => {
  return request({
    url: `/parking/card/${id}`,
    method: 'GET',
  });
};

/*删除月卡接口*/
export const deleteCardListApi = (ids) => {
  return request({
    method: 'DELETE',
    url: `/parking/card/${ids}`,
  });
};

/*获取月卡占有率接口*/
export const fetchCardProportionApi = () => {
  return request({
    method: 'GET',
    url: `/parking/card/proportion`,
  });
};
